UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TL9my4fEMD1xsuJCDHD0ISZLd0Sn+IUcv1J66OSej3U='
WHERE
key_id = '4b05f6e48a25a95ab6710e41e6d77b8c54a203657c82f27ee22703be5833d3ce'
AND (
token = 'TL9my4fEMD1xsuJCDHD0ISZLd0Sn+IUcv1J66OSej3U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)