UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TCN+x7/rwiTZL773r2ORoTFdZB0Mss3FRYoFZx0X5/U='
WHERE
key_id = 'b29360766340af32155cb55d0402668d2dba37637f0b108ab0c011e050dd8a31'
AND (
token = 'TCN+x7/rwiTZL773r2ORoTFdZB0Mss3FRYoFZx0X5/U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)