UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tUw1OGQRlUb49/06RLRHbw12zzPVt453fVTZhPqZwZY=' 
WHERE 
  key_id = '5ecae39b616c1cba27ebc59cdf4f679c90616986eba4e829541ec7cc1431df2b' 
  AND (
    token = 'tUw1OGQRlUb49/06RLRHbw12zzPVt453fVTZhPqZwZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041