UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rXiTMAbtq1D9l46EjcoZmTVAJqpkhMw/UbJN+6e6nA0='
WHERE
key_id = 'a1a7962d0d43a7149052fe98ad27b6b8e76932068ffaaf8c771bbe9ac3723ff8'
AND (
token = 'rXiTMAbtq1D9l46EjcoZmTVAJqpkhMw/UbJN+6e6nA0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)