UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lix67QxISKuKPu7QxgG/uH872Or5QuEbziU+SD2MAJw=' 
WHERE 
  key_id = '57de70f1f97bcb19fb0d5a64ea6c3fe20d3028306057b0742f8bfc26ff6bb14a' 
  AND (
    token = 'lix67QxISKuKPu7QxgG/uH872Or5QuEbziU+SD2MAJw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027