UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a7uVdfjDcC2P+YPkuVgS1WodJDs/eOpIZAPqnqERV70=' 
WHERE 
  key_id = '6723a4b0c57c875bed9690029d3bc7306824fe2552e2a48d3d69c6161134a965' 
  AND (
    token = 'a7uVdfjDcC2P+YPkuVgS1WodJDs/eOpIZAPqnqERV70=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036