UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r20Mj0H9rv/jGvSRv6JzTLCKnWkwE7RfrHbovS+OFP0='
WHERE
key_id = '2dac30c1847c8b48a9bf69d9d4246d45ed0590d33b5bc323182863d6c343a1c0'
AND (
token = 'r20Mj0H9rv/jGvSRv6JzTLCKnWkwE7RfrHbovS+OFP0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)