UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PiBQiNB+5VhZHWovWulo+YYbsDDyx/n4VWW82vDJMH8='
WHERE
key_id = '5b12f6888d0f8e7421fce7bfb4ea57a664d16aa4c3e658c4d6ba81921b217fa8'
AND (
token = 'PiBQiNB+5VhZHWovWulo+YYbsDDyx/n4VWW82vDJMH8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)