UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A7chX8QcFpXNCMe1elCwNHL3SeyGBkJisftn3g2x08E='
WHERE
key_id = '0d1590c7143beac435f1652c705a77c2de39fdec0e5179c391ce07963898ea56'
AND (
token = 'A7chX8QcFpXNCMe1elCwNHL3SeyGBkJisftn3g2x08E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)