UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5+NXL1HFKDiWp4GZAAcYMiuU23VinwlrEJaUVVq61tQ=' 
WHERE 
  key_id = '95ce12869ac61d105c631313b7bbc345e96b21e3da6dd307fe58e934d4a047b9' 
  AND (
    token = '5+NXL1HFKDiWp4GZAAcYMiuU23VinwlrEJaUVVq61tQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024