UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ENTh0HUCJu5ckxHEnExirL5qASPIi7PWsqCURikQnbY=' 
WHERE 
  key_id = '1b0fc2d247c750aa512c014818974ed10bf88422959abb73980da135cfec5d1f' 
  AND (
    token = 'ENTh0HUCJu5ckxHEnExirL5qASPIi7PWsqCURikQnbY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030