UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sAdV3XtQytFIVr8Eh250g+tuq8PgTkZHejjUwGAb9Uo='
WHERE
key_id = '5dd47311a21572f383715d42c595cd4549fa6a0f3b5a676290c36f95ce79d2fb'
AND (
token = 'sAdV3XtQytFIVr8Eh250g+tuq8PgTkZHejjUwGAb9Uo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)