UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l5i5ElF2xnDOcVvGGuzz8KZNU112JERS7cP+g2htlRw=' 
WHERE 
  key_id = '65e572b84135603945f9d4c1ae0d832db557617edfc1e97a6bdb16776ea374e4' 
  AND (
    token = 'l5i5ElF2xnDOcVvGGuzz8KZNU112JERS7cP+g2htlRw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057