UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eEY8fbgO0ziHP0rShZta38kezWDIQTSVg4AlJI8tiWg=' 
WHERE 
  key_id = 'f982c9b34726381caf8f4717abc42e888c3509afc2e688a1066f5396f7437c47' 
  AND (
    token = 'eEY8fbgO0ziHP0rShZta38kezWDIQTSVg4AlJI8tiWg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040