UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vY3zuH8Ng3IRX0gPUczUZjXrwIJB1OzzesTNP9JTJkE='
WHERE
key_id = '3036856b271b93d1e3be4df704011d8f2460353821b3b641d04033d5746d181a'
AND (
token = 'vY3zuH8Ng3IRX0gPUczUZjXrwIJB1OzzesTNP9JTJkE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)