UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ONuW+fCh5Ro0xISUxaehRu8nWwKHPugR/F4EtwR30uE='
WHERE
key_id = '4d22ccb2b46e44006366e2cb2587d1510795795d77c38c85695a9af29336e87d'
AND (
token = 'ONuW+fCh5Ro0xISUxaehRu8nWwKHPugR/F4EtwR30uE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)