UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vPL1FGp3X3K8zIBUCLT4RLlli8EjX6C9SCCckFIr6KQ=' 
WHERE 
  key_id = '18f4c1ff44aafd3e6bde13960ebe28942c09a9b19139a6fe84056e486e71eea3' 
  AND (
    token = 'vPL1FGp3X3K8zIBUCLT4RLlli8EjX6C9SCCckFIr6KQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035