UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZcBKVMTC2j1jMEM7FD4AeSExXW21W+lHju+B8jG9+rg=' 
WHERE 
  key_id = '686d3a791223211ac897d9974f549b60253a30cbc86c4b515e24b6c594ca4cfe' 
  AND (
    token = 'ZcBKVMTC2j1jMEM7FD4AeSExXW21W+lHju+B8jG9+rg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016