UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j052zYNEZ93UDHOn3EZlqZlEYmMffShruyI5HK2vRsk='
WHERE
key_id = '0d9159f0aeb0de5f8c16089c2ed2c98cc52ce491e9983d9515193d7ac84fe009'
AND (
token = 'j052zYNEZ93UDHOn3EZlqZlEYmMffShruyI5HK2vRsk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)