UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i09u5F5D0vcI7s5Ue9XVp8ABO8ah0ngVWZX8OdqIFDU='
WHERE
key_id = '7b2f8465c4c17c8865038b319298cc92231d778c162f4927d8809b74b4202c74'
AND (
token = 'i09u5F5D0vcI7s5Ue9XVp8ABO8ah0ngVWZX8OdqIFDU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)