UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CqKejzoTSWIBlgo8CaB9CbOaqKudDVVTepWIEeeqEQA=' 
WHERE 
  key_id = '4e50997a2666c929bf26045cf4e9f48abcbea848c8c7b49cfcb2e2019dc50d8e' 
  AND (
    token = 'CqKejzoTSWIBlgo8CaB9CbOaqKudDVVTepWIEeeqEQA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00073