UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IwIAMxyrqsCKxlGRXW+bmEH+2xknel3WIDyXcFkLA6I='
WHERE
key_id = 'e635e52b7d551f947677c8412a7e2843ac86a4e8723c2eb5ebaeb0a201fab803'
AND (
token = 'IwIAMxyrqsCKxlGRXW+bmEH+2xknel3WIDyXcFkLA6I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)