UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/EAub8ki0+OjoFcnhepafNcZ/bsDJ7oAruWJzygHofM=' 
WHERE 
  key_id = 'f833b4edc412c69a8fd7eea659da4308ceac9589f360ab43a25787460d841a10' 
  AND (
    token = '/EAub8ki0+OjoFcnhepafNcZ/bsDJ7oAruWJzygHofM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035