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