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