UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iwET94C5Jje55OKjBrprusvp1KzQ2fQKzmCC++Xwn8A='
WHERE
key_id = 'dbd2cebe66d369532511496988d28a1a06ad8b1860f595f999a6f04cf8c64b0b'
AND (
token = 'iwET94C5Jje55OKjBrprusvp1KzQ2fQKzmCC++Xwn8A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)