UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZRI+F1ulPa6Bo3EbkDMy3a0sSgAvSJ9Qb3XWm5tNCW8='
WHERE
key_id = 'd3ff8a0a350a0e0ce6e5da38f5574bd3e57bbce61f494d6aa2c5d46919854300'
AND (
token = 'ZRI+F1ulPa6Bo3EbkDMy3a0sSgAvSJ9Qb3XWm5tNCW8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)