UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N3uS/ui171UJTnm/IeDZIOnJPyG0gKdOxnJxr15amTU='
WHERE
key_id = 'b596dad9c3f884791a891fa239cfa5158759f70c8533be56c9f143ec07eefbf2'
AND (
token = 'N3uS/ui171UJTnm/IeDZIOnJPyG0gKdOxnJxr15amTU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)