UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'puM/zYBVg9hEUjWuHvaF2TIjX/BjGRzKf7yyl99uQmo=' 
WHERE 
  key_id = '277cca121cfb446b6b998fbfb8dd35033e99633b9248c463718cb763aba46bf3' 
  AND (
    token = 'puM/zYBVg9hEUjWuHvaF2TIjX/BjGRzKf7yyl99uQmo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019