UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5QEQnni956+rVQ8kh6pTeayfaOlDpXItRrVwFINCf/U=' 
WHERE 
  key_id = 'a902cca782d9f66912550b695293951393857aff67f1608271a5242bd4f32203' 
  AND (
    token = '5QEQnni956+rVQ8kh6pTeayfaOlDpXItRrVwFINCf/U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021