UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O1TrrbaHa1BCNbcStG9Dgc0cIR4n3mn9me0xXhbWjXo='
WHERE
key_id = '649764edfad9fae1b97d297995d536548023b6a489df3e684b743f8fb227988d'
AND (
token = 'O1TrrbaHa1BCNbcStG9Dgc0cIR4n3mn9me0xXhbWjXo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)