UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eHkR5PxYncY4Fw/10f6hq4O+Fb9woUMsaJYNDyJ6Yd0='
WHERE
key_id = 'e8b3c30cda44a82b0e563261a51887ac8e31843af4cdfb926f90f130b618f977'
AND (
token = 'eHkR5PxYncY4Fw/10f6hq4O+Fb9woUMsaJYNDyJ6Yd0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)