UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'euNXqsL7eCSxMEJXFO9hxfUNb2ILiWF77j8LXS8oY98='
WHERE
key_id = '8fbb0fab9fd861a08644f25d1e439b234fd163a1b12b0ed809e3cf5884bec2c8'
AND (
token = 'euNXqsL7eCSxMEJXFO9hxfUNb2ILiWF77j8LXS8oY98='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)