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