UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hlHX8u/Z9gMeQtstg4I2m71OMeqqNNfZRNEfk5t3fu8='
WHERE
key_id = '7b814dd485f3adb0befe8508dd959ea41c4394d5967391d754ac53dc540da5ce'
AND (
token = 'hlHX8u/Z9gMeQtstg4I2m71OMeqqNNfZRNEfk5t3fu8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)