UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WhbSkPWUpjxiGQN0vw8gdcxTryMHvkcYLnRd4zfGKZg='
WHERE
key_id = 'f71a4967631f4640ac21190fca85caa6cae5cb349f496bd9cf42d6d5cb8f2b7d'
AND (
token = 'WhbSkPWUpjxiGQN0vw8gdcxTryMHvkcYLnRd4zfGKZg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)